package com.tamo.ppresta.dialog;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import com.xuexiang.xui.widget.dialog.DialogLoader;

/**
 * @author yeyang
 * @name ppresta
 * @class name：com.tamo.ppresta.dialog
 * @class describe
 * @time 2022/12/21 12:09
 * @change
 * @chang time
 * @class describe
 */
public class DialogManager {

    // 请求权限对话框
    public static void permissionDialog(Context context, String str) {
        DialogLoader.getInstance().showConfirmDialog(
                context, "提示", str, "去设置",
                (dialog, which) -> {
                    //引导用户到设置中去进行设置
                    Intent intent = new Intent();
                    intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
                    intent.setData(Uri.fromParts("package", context.getPackageName(), null));
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    context.startActivity(intent);
                    dialog.dismiss();
                },
                "取消",
                (dialog, which) -> {
                    dialog.dismiss();
                }
        );
    }
} 